package com.suxiaoxiao.springbootlearn.designpattern.adapterpattern.iteratoradapter;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * 迭代器适配枚举
 * @author 、
 */
public class IteratorAdapter implements Enumeration {

    Iterator iterator;

    public IteratorAdapter(Iterator iterator) {
        this.iterator = iterator;
    }

    @Override
    public boolean hasMoreElements() {
        return iterator.hasNext();
    }

    @Override
    public Object nextElement() {
        return iterator.next();
    }

}
